package main

import (
	"comm/comminit"
	"comm/commrun"
	"context"
	"core/coreinit"
	"core/corerun"
	"core/corestruct"
	"core/db"
	"core/server/baseserver"
	"core/server/httpserver"
	"ht/htinit"
)

func main() {
	coreinit.Init()
	htinit.Init()

	var ctx = &corestruct.HttpContext{
		Id: 0,
		Session: &corestruct.HttpSession{
			CrtUid:   1000,
			HtdeptId: 1000,
		},
		DB: db.DbMaster,
	}

	dbctx := context.WithValue(context.Background(), "MyContext", ctx)
	var db = db.DbMaster.WithContext(dbctx)
	ctx.DB = db

	comminit.Init()

	corerun.DbSetup("comm")
	corerun.StructToDb("comm", db)
	corerun.ActionToDb("comm", db)

	commrun.DBSetup()

	httpserver.Run()

	baseserver.WaitCloseSignals()
}
